<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>网络货运平台省运管数据控制台</title>
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="小镖人、社区、网络货运">
    <meta name="description" content="小镖人、社区、网络货运">
    <link rel="stylesheet" href="../../xbr_layui_extend/layui-v2.6.8/css/layui.css">
    <style>
        .layui-layout-admin {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 50px;
        }

        .layui-layout-admin .layui-footer {
            padding: 10px 0;
            text-align: center;
            left: 0
        }
    </style>
</head>
<body>
<div class="layui-fluid" style="padding: 15px;">
    <form class="layui-form" action="" lay-filter="form-initPlat" id="userForm" method="post">
        <div class="layui-form-item">
            <p>提示：你的登录已失效，需要重新验证登录状态</p>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">账户名</label>
            <div class="layui-input-block">
                <input type="text" id="username" name="username" lay-verify="required"
                       placeholder="在云平台添加的API账户名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">API授权密码</label>
            <div class="layui-input-block">
                <input type="text" id="customerKey" name="customerKey" lay-verify="required"
                       placeholder="API授权密码" class="layui-input">
            </div>
        </div>
        <!--提交按钮-->
        <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
                <div class="layui-footer">
                    <button id="text9" class="layui-btn" lay-submit="" lay-filter="post-initPlat"><i class="layui-icon">&#xe605;</i>验证
                    </button>
                </div>
            </div>
        </div>
    </form>
</div>


<script src="../../xbr_layui_extend/layui-v2.6.8/layui.js"></script>
<script>
    layui.extend({
        admin: '/platform/xbr_layui_extend/admin' //集成路径
    }).use(["admin", 'form'], function () {
        const $ = layui.$, form = layui.form, admin = layui.admin;

        //上传完毕 提交表单
        form.render(null, 'form-initPlat');
        form.on('submit(post-initPlat)', function (data) {

            admin.req({
                url: "/platform/user/login",
                data:data.field,
                type: 'post',
                done: function (res) {
                    layer.msg(res.msg, {offset: 'auto', icon: 1,time:1000},function () {
                        if (res.code === 0) {
                            const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.location.reload();
                            parent.layer.close(index);
                        }
                    });

                }
            });
            return false;
        });

    });
</script>
</body>
</html>